<template>
  <button @click="copyToClipboard" class="copy-button">复制</button>
</template>

<script>
export default {
    methods:{
        copyToClipboard() {
        if (this.idCardNumber) {
          navigator.clipboard.writeText(this.idCardNumber)
            .then(() => {
              alert('身份证号已复制到剪切板');
            })
            .catch(err => {
              console.error('复制失败:', err);
            });
        }
      }
    }
}
</script>

<style>

</style>